<html>
<head><meta charset="utf-8"><title>Is rustc_interface a rustc interface? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html">Is rustc_interface a rustc interface?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196069886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> George Fraser <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069886">(May 02 2020 at 21:00)</a>:</h4>
<p>This started as a discord discussion (<a href="https://internals.rust-lang.org/t/using-the-rustc-interface-crate/11982/22" title="https://internals.rust-lang.org/t/using-the-rustc-interface-crate/11982/22">https://internals.rust-lang.org/t/using-the-rustc-interface-crate/11982/22</a>) with <span class="user-mention" data-user-id="133247">@bjorn3</span> and <span class="user-mention" data-user-id="198054">@mark-i-m</span> and then evolved into a github issue (<a href="https://github.com/rust-lang/rust/issues/71770" title="https://github.com/rust-lang/rust/issues/71770">https://github.com/rust-lang/rust/issues/71770</a>) discussion with <span class="user-mention" data-user-id="116122">@simulacrum</span> . The original motivation was "I would like to be able to read the stream of diagnostics without having to buffer and parse JSON", but it seems this is an instance of a larger question: is rustc_interface intended to be a high-level interface for rustc?</p>



<a name="196069957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> George Fraser <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069957">(May 02 2020 at 21:02)</a>:</h4>
<p>rustc_interface seems to be missing many of the components you typically see in a compiler API like the Java Compiler API, or F# compiler service, or many others. Such as, documentation of how to do basic tasks like parsing and getting a pointer to a range, or the present example of a typed API for diagnostics. I am happy to help work on these things, but based on <span class="user-mention" data-user-id="116122">@simulacrum</span> response in the github issue, I am now wondering whether rustc_interface is in fact intended to be a compiler-API in the tradition of these other compiler APIs I have mentioned.</p>



<a name="196069966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069966">(May 02 2020 at 21:03)</a>:</h4>
<p>No, I don't think it is, or at least not today</p>



<a name="196069972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069972">(May 02 2020 at 21:03)</a>:</h4>
<p>it's intended perhaps for internal consumption (e.g. clippy would also use it, I believe)</p>



<a name="196069974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> George Fraser <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069974">(May 02 2020 at 21:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116466">@Zoxc</span> FYI</p>



<a name="196069975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Is%20rustc_interface%20a%20rustc%20interface%3F/near/196069975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Is.20rustc_interface.20a.20rustc.20interface.3F.html#196069975">(May 02 2020 at 21:03)</a>:</h4>
<p>but not really for public consumption</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>